﻿using System;
using fastCSharp;

namespace diantou.web.tutorial
{
    /// <summary>
    /// 课程
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsPage = false)]
    partial class course : web.currentUserView<course> 
    {
        /// <summary>
        /// 课程
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        public diantou.dataAccess.course Course;
        /// <summary>
        /// 用户课程
        /// </summary>
        private userCourse userCourse
        {
            get { return new userCourse { Course = Course, User = currentUser }; }
        }
        /// <summary>
        /// 课程分页
        /// </summary>
        private diantou.dataAccess.coursePage currentPage;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="courseId"></param>
        /// <returns></returns>
        private bool loadView(int courseId)
        {
            Course = diantou.dataAccess.tcpCall.course.Get(courseId);
            if (Course == null) AjaxResponse(webConfig.NotFound404);
            else if (userCourse.IsLock && !userCourse.IsPermission) AjaxResponse(new diantou.dataModel.path.tutorial { Id = Course.TutorialId }.Index);
            else return true;
            return false;
        }
    }
}
